import {
  http
} from '@/utils/http.js'

/**
 * 获取所有设备类型
 */
export const getEquipeAllApi = () => {
  return http({
    url: '/machineType/all',
    method: 'GET',
  })
}

/**
 * 根据类型搜规格
 */
export const getSpecificationsApi = (data) => {
  return http({
    url: '/specification/filter/get',
    method: 'GET',
    data: {
      machineTypeName: data
    }
  })
}

/**
 * 获取所有设备厂家
 */
export const getNameAllApi = () => {
  return http({
    url: '/manufacturer/all',
    method: 'GET',
  })
}

/**
 * 根据设备类型厂家等查询详细设备信息
 */
export const getEquipmentInfoApi = (data) => {
  return http({
    url: `/machine/getMachine`,
    method: 'GET',
    data
  })
}


/**
 * 获取用户设备列表
 */
export const getEquipmentListAllApi = () => {
  return http({
    url: '/userMachine/list',
    method: 'GET'
  })
}

/**
 * 删除我的设备
 */
export const delMyEquimentApi = (data) => {
  return http({
    url: '/userMachine/delete?machineModelNumbers=' + data,
    method: 'DELETE'
  })
}


/**
 * 添加设备
 */
export const addEquimentApi = (data) => {
  return http({
    url: `/userMachine/insert?machineModelNumber=${data}`,
    method: 'POST',
  })
}

/**
 * 获取用户订单
 */
export const onLoadClickSystemDatasApi = (page, id) => {
  return http({
    url: `/order/${page}`,
    method: 'POST',
    data: {
      userId: id
    }
  })
}

/**
 * 获取维修员工单
 */
export const onLoadClickSystemDatasReaairApi = (page, id) => {
  return http({
    url: `/order/${page}`,
    method: 'POST',
    data: {
      maintainerId: id
    }
  })
}


export const getorderPartAPI = (orderId) => {
  return http({
    url: `/orderPart/get/${orderId}/page/1`,
  })
}


/**
 * 获取用户全部订单数据
 */
export const getOrderListAllAPI = (id) => {
  return http({
    url: '/order/list',
    method: 'POST',
    data: {
      userId: id
    }
  })
}
